import {proxy} from "@@/exports";
import {ActivityAwardVO} from "@/services/ActivityAwardService";

interface ActivityAwardModelType {
    activityAward?: ActivityAwardVO;
    updateModalState: boolean;
}

const state = proxy<ActivityAwardModelType>({
    activityAward: undefined,
    updateModalState: false,
})

const actions = {
    /**
     * 设置修改模态框状态
     * @param modalState 状态
     */
    setUpdateModalState(modalState: boolean) {
        state.updateModalState = modalState
    },
    /**
     * 打开模态框
     * @param modalState
     * @param activityAward
     */
    openUpdateModal(modalState: boolean, activityAward?: ActivityAwardVO) {
        state.activityAward = activityAward
        state.updateModalState = modalState
    },
};


export const ActivityAwardModel = {state, actions}